package com.dayaokeji.rhythmschoolstudent.client.home.meeting.adapter;

import android.support.v7.widget.AppCompatCheckBox;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.dayaokeji.rhythmschoolstudent.R;
import com.dayaokeji.rhythmschoolstudent.client.home.meeting.ChooseParticipantsActivity;
import com.dayaokeji.server_api.domain.UserInfo;

/**
 * Created by Gorden on 2017/10/13.
 */

public class ParticipantsListAdapter extends BaseQuickAdapter<UserInfo,BaseViewHolder> {

    public ParticipantsListAdapter() {
        super(R.layout.item_choose_participants, null);
    }

    @Override
    protected void convert(BaseViewHolder helper, UserInfo item) {
        helper.addOnClickListener(R.id.cb_choose);
        helper.setText(R.id.tv_name,mContext.getString(R.string.member_name,item.getName()));
        helper.setText(R.id.tv_work_no,mContext.getString(R.string.user_job_number,item.getWorkNo()));

        AppCompatCheckBox checkBox = (AppCompatCheckBox) helper.getView(R.id.cb_choose);
        if (ChooseParticipantsActivity.CHOOSER_USERS.contains(item)) {
            checkBox.setChecked(true);
        }else{
            checkBox.setChecked(false);
        }
    }
}
